import React, { Component } from 'react';
import {Form, Button, Input} from 'antd';
import { connect } from 'react-redux';
import {actionCreators} from './store'

class NodeForm extends Component{

    constructor(props) {
        super(props);
        this.formRef = React.createRef()
        this.state={
        };
      }

    componentDidMount(){
        this.props.onRef(this);
    }

    render(){
        const config = [{
                required:true,
                message:'Please input!'
            }]

        return (
            <Form labelCol={{span:6}} wrapperCol={{span:12}} ref={this.formRef}>
                <Form.Item label='IP地址' name='ip' rules={config}>
                    <Input placeholder='请输入节点IP地址' />
                </Form.Item>
                <Form.Item label='主机名' name='hostname' rules={config}>
                    <Input placeholder='请输入主机名' />
                </Form.Item>
                <Form.Item label='用户名' name="userName" rules={config}>
                    <Input placeholder='请输入用户名' />
                </Form.Item>
                <Form.Item label='密码' name='password' rules={config}>
                    <Input.Password placeholder='请输入密码' />
                </Form.Item>
            </Form>
        )
    }
}

export default NodeForm;